package shiyan;

/**
 * Created by Lenovo on 2017-05-01.
 */
import static java.lang.String.valueOf;

/**
 * Created by DELL on 2017/4/20.
 */
public class StringBufferDemo {
    static StringBuffer buffer = new StringBuffer(2333);
    public static String ziFu(int n) {
        StringBuffer buffer1 = new StringBuffer();

        buffer1.append('S');
        buffer1.append("tringBuffer");
        if (n > buffer1.length() || n < 0)
            return "Input error.";
        else
            return "It is " + buffer1.charAt(n);
    }
    public static int rongLiang(int n) {
        StringBuffer buffer = new StringBuffer(2333);//指定容量为2333
        if (n == 1)
            return buffer.capacity();
        else
            return 0;
    }
    public static int testindex(String S) {
        buffer.append("I love you!");
        return buffer.indexOf(S);
    }

}
